import { createRouter, createWebHashHistory } from 'vue-router';
const Layout = () => import(/* webpackChunkName:'layout' */ '@/Layout');
const Dashboard = () =>
	import(/* webpackChunkName:'dashboard' */ '@/views/Dashboard');
const Permission = () =>
	import(/* webpackChunkName:'permission' */ '@/views/Permission');
const Role = () => import(/* webpackChunkName:'role' */ '@/views/Role');
const User = () => import(/* webpackChunkName:'user' */ '@/views/User');
const UserProfile = () =>
	import(/* webpackChunkName:'userProfile' */ '@/views/UserProfile');

const Department = () =>
	import(/* webpackChunkName:'department' */ '@/views/Department');
const Jobs = () => import(/* webpackChunkName:'jobs' */ '@/views/Jobs');
const Dictionary = () =>
	import(/* webpackChunkName:'dictionary' */ '@/views/Dictionary');
const DictionaryData = () =>
	import(/* webpackChunkName:'dictionaryData' */ '@/views/DictionaryData');
const Login = () => import(/* webpackChunkName:'login' */ '@/views/Login');

const H5ShopDecoration = () =>
	import(
		/* webpackChunkName:'h5ShopDecoration' */ '@/views/ShopDecoration/H5ShopDecoration'
	);
const PcShopDecoration = () =>
	import(
		/* webpackChunkName:'pcShopDecoration' */ '@/views/ShopDecoration/PcShopDecoration'
	);

const H5ShopDecorationEdit = () =>
	import(
		/* webpackChunkName:'h5ShopDecorationEdit' */ '@/views/ShopDecoration/H5ShopDecoration/Edit'
	);
/**
 * Note: 路由配置项
 * hidden: true                   // 当设置 true 的时候该路由不会再侧边栏出现
 * redirect: noRedirect           // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
 * meta : {
    title: 'title'               // 设置该路由在侧边栏和面包屑中展示的名字
    icon: 'svg-name'             // 设置该路由的图标，对应路径src/assets/icons/svg
    breadcrumb: false            // 如果设置为false，则不会在breadcrumb面包屑中显示
  }
 */
export const asyncRoutes = [
	{
		path : '/dashboard',
		component : Layout,
		meta : {
			title : '首页',
			icon : 'dash-board'
		},
		children : [
			{
				path : '',
				component : Dashboard,
				meta : {
					title : '首页',
					icon : 'dash-board'
				}
			}
		]
	},
	{
		path : '/shopDecoration',
		component : Layout,
		meta : {
			title : '营销管理',
			icon : 'yingxiaoguanli'
		},
		children : [
			{
				path : 'h5ShopDecoration',
				component : H5ShopDecoration,
				meta : {
					title : '移动端店铺管理',
					icon : 'zhuangxiudianpu'
				}
			},
			{
				path : 'pcShopDecoration',
				component : PcShopDecoration,
				meta : {
					title : 'PC端店铺管理',
					icon : 'dianpuzhuangxiu'
				}
			},
			{
				path : 'h5ShopDecorationEdit/:id',
				component : H5ShopDecorationEdit,
				hidden : true,
				meta : {
					title : '移动端店铺装修',
					icon : 'zhuangxiudianpu'
				}
			},
			{
				path : 'pcShopDecorationEdit/:id',
				component : H5ShopDecorationEdit,
				hidden : true,
				meta : {
					title : 'PC端店铺装修',
					icon : 'zhuangxiudianpu'
				}
			}
		]
	},
	{
		path : '/system',
		component : Layout,
		redirect : 'noRedirect',
		meta : {
			title : '系统管理',
			icon : 'xitong'
		},
		children : [
			{
				path : 'user',
				component : User,
				meta : {
					title : '用户管理',
					icon : 'user-fill'
				}
			},
			{
				path : 'role',
				component : Role,
				meta : {
					title : '角色管理',
					icon : 'jiaose'
				}
			},
			{
				path : 'permission',
				component : Permission,
				meta : {
					title : '权限管理',
					icon : 'tree-table'
				}
			},
			{
				path : 'department',
				component : Department,
				meta : {
					title : '部门管理',
					icon : 'bumenguanli'
				}
			},
			{
				path : 'jobs',
				component : Jobs,
				meta : {
					title : '岗位管理',
					icon : 'qiyeguanli_gangweiguanli'
				}
			},
			{
				path : 'dictionary',
				component : Dictionary,
				meta : {
					title : '字典管理',
					icon : 'zidianguanli'
				}
			},
			{
				path : 'dictionaryData/:id',
				component : DictionaryData,
				hidden : true,
				meta : {
					title : '字典数据管理',
					icon : 'zidianguanli'
				}
			},
			{
				path : 'userProfile',
				component : UserProfile,
				hidden : true,
				meta : {
					title : '个人中心'
				}
			}
		]
	}
];

const routes = [
	{
		path : '/login',
		name : 'Login',
		hidden : true,
		component : Login,
		meta : {
			title : '登录'
		}
	}
];

const router = createRouter({
	history : createWebHashHistory(process.env.BASE_URL),
	routes,
	scrollBehavior () {
		return { left : 0, top : 0 };
	}
});

export default router;
